package post

import (
	"github.com/gin-gonic/gin"
	"strconv"
	"apiserver/model"
	"apiserver/handler"
	"apiserver/errno"
)

func Detail(c *gin.Context) {
	pid, _ := strconv.Atoi(c.Param("pid"))
	post, err := model.GetPostDetail(uint64(pid))
	if err != nil {
		handler.SendResponse(c, errno.ErrDatabase, nil)
		return
	}
	handler.SendResponse(c, nil, post)
}
